//
//  HYOUTopicDetailViewController.m
//  BestGift
//
//  Created by 温晓宇 on 16/1/11.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HYOUTopicDetailViewController.h"
#import "HYOUTopicDetailTableView.h"
#import "HYOUWebViewController.h"
@interface HYOUTopicDetailViewController ()<HYOUTopicDetailTableViewDelegate>

@property(nonatomic, retain)HYOUTopicDetailTableView *myTableView;

@property(nonatomic, retain) NSMutableArray *allArray;

@end

@implementation HYOUTopicDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.myTableView = [[HYOUTopicDetailTableView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
//    self.myTableView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.myTableView];
    [self.myTableView.myTableView reloadData];
    self.myTableView.delegate = self;
    
    NSLog(@"%@",self.url);
    self.allArray = [NSMutableArray array];
    [AppTools finalAFNWithURLString:self.url parameters:nil successAFNBlock:^(id resuposeObject) {
        NSMutableDictionary *bigDic = resuposeObject;
        NSMutableDictionary *data = [bigDic objectForKey:@"data"];
        NSMutableArray *posts = [data objectForKey:@"posts"];
        for (NSDictionary *dic in posts) {
            HYOUOneCellModel *model = [[HYOUOneCellModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.allArray addObject:model];
        }
        self.myTableView.bigArray = self.allArray;
    }];
    
}
-(void)listTopicWeb:(NSString *)url Image:(NSString *)image title:(NSString *)title;{
    HYOUWebViewController *web = [[HYOUWebViewController alloc]init];
    web.url = url;
    web.image = image;
    web.name = title;
    [self.navigationController pushViewController:web animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
